<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>

<% String m_id = (String)session.getAttribute("member"); %>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="/bigjo/js/jquery.js"></script>
<title>Insert title here</title>
</head>
<style type="text/css">
	table{
		text-align: center;
		border: 1px;
	}
	td{
		margin-right: 30px;
	}
	a{
		TEXT-DECORATION:none;
	}
	#boardList{
		margin-top: 50px;
		margin-left: 500px;
	}
	
	
	.delete{font-size: 13px;}
	.update{font-size: 13px;}
</style>

<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function(){
	/*  입력처리 */
	jQuery(".sbin").click(function(){
		var idx = document.URL.indexOf("bigjo");
		var str = document.URL.substring(0,idx+5);
		var s_no = jQuery(this).attr("id");
		jQuery.ajax({
			url: str + "/sBoardInsertform.singer?s_no="+s_no,
			error:function(data){
				alert("오류 발생");
			},
			success : function(data){
				jQuery("#slist").html(data);
			}
		});
	});
	/*  삭제처리 */
	jQuery.noConflict();
	jQuery(".delete").click(function(){
		var idx = document.URL.indexOf("bigjo");
		var str = document.URL.substring(0,idx+5);
		var s_no = jQuery(this).attr("id");
		var sb_no = jQuery(this).attr("name");
		if (confirm("정말 삭제 하시겠습니까?") == true){    //확인
			document.location.href	= str + "/sBoardDelete.singer?s_no="+s_no+"&sb_no="+sb_no;
		}else{   //취소
		return;
		}
		
		
	});
	/*  업데이트 처리 */
	jQuery.noConflict();
	jQuery(".update").click(function(){
		var idx = document.URL.indexOf("bigjo");
		var str = document.URL.substring(0,idx+5);
		var s_no = jQuery(this).attr("id");
		var sb_no = jQuery(this).attr("name");
		jQuery.ajax({
			url : str + "/sBoardUpdateform.singer?s_no="+s_no+"&sb_no="+sb_no,
			error:function(data){
				alert("오류 발생");
			},
			success : function(data){
				jQuery("#slist").html(data);
			}
		});
	});
});	
</script>

<body>

<jsp:include page="/upMenu.main"></jsp:include>
<div id="slist">
	<table align="left" id="boardList">
		<tr>
			<td>글번호</td><td>게시자</td><td>제목</td>
		</tr>
	<c:forEach var="sboard" items="${sboard}">
		<tr  class="${sboard.sb_no}input">
			<td>${sboard.rank}</td>
			<td>${sboard.sb_m_id}</td>
			<td><a href="sBoardDetail.singer?sb_no=${sboard.sb_no}">${sboard.sb_title}</a></td>
			<td><input type="hidden" id="s_no" value="${sboard.sb_s_no}"></td>
			<td><input style="width: 30px;"  ${sboard.disable} class="delete" name="${sboard.sb_no}" id="${sb_s_no}" value="삭제">&nbsp;&nbsp;<input style="width: 30px;" ${sboard.disable} class="update" name="${sboard.sb_no}" id="${sb_s_no}" value="수정"></td>
		</tr>
	</c:forEach>
	<tr>
	<td colspan="5"><a id="${sb_s_no}" class="sbin">글쓰기</a><br>${pageInfo.pagingHtml}
	</tr>
	</table>
</div>
</body>
</html>